<?php
/*
	[BuyPg] (C) 2010-2011 Buypg
	$Id: TuangouAction.class.php 2011-7-8 11:26:22 wufujun $
 */
if (!defined('THINK_PATH')) {
	exit('Access Denied');
}

class TuangouAction extends BpAction{
	/**
	 * +----------------------------------------------------------
	 * 默认操作
	 * +----------------------------------------------------------
	 */
	public function index(){
		global $_SGLOBAL;
		//继承初始网站系统相关信息
		$pgsys = $this->PublicPgsys;
		$classid = $_GET['classid'] = 49 ;
		//默认以f1--网站易用排行
		$o = isset ($_GET['o']) ? $_GET['o'] : 'f1';
		if($classid){
			$DbSite = M('NbClass');
			$arrClass = $DbSite->where("class_id = $classid")->find();
			$DbSite = M('NbSite');
			$arrSite = $DbSite->where("class_id = $classid and flag = 1")->order("$o DESC")->select();
			if($arrSite){
				//格式化数据
				foreach ($arrSite as $key=>$value){
					$arrSite[$key]['site_name'] = 	msubstr($value['site_name'], 0, 10, 'utf-8', FALSE);
					$arrSite[$key][$o] = formatFen($value[$o]);
					if($arrSite[$key]['country_id'] == 0){
						$guoneiSite[] = $arrSite[$key];
					}else{
						$guowaiSite[] = $arrSite[$key];
					}
				}
			}else{
				$this->error('您查看的信息不存在或已经删除');
			}
		}else{
			$this->error('您查看的信息不存在或已经删除');
		}
		//定义左侧分类
		$LeftCate = getLeftCategory();

		//模板输出
		$this->assign('show_zhanti_menu' , 1); //左侧菜单显示专题
		$this->assign('o' , $o);
		$this->assign('leftcate' , $LeftCate);
		$this->assign('descmenu' , $pgsys['sys_webping_desc']); //排序菜单
		$this->assign('classinfo' , $arrClass);
		$this->assign('guonei' , $guoneiSite);
		$this->assign('guowai' , $guowaiSite);
		//模板输出
		$this->display('./Tpl/default/Webping/webpingall.html');
	}
	
	public function nav(){
		$this->display('./Tpl/default/Tuangou/index.html');
	}
}
?>
